﻿@model CNav.Model.UpdateBusinessModel

@{
    ViewBag.Title = "Edit business account";
}

@using (Html.BeginForm("Edit", "RegisterBusiness", FormMethod.Post, new { name = "frmMain", id = "frmMain" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <div id="editProfileAccordion">
        <ol>
            <li>
                @Html.LabelFor(m => m.BusinessName)
                @Html.TextBoxFor(model => model.BusinessName)
                <br />
                @Html.ValidationMessageFor(model => model.BusinessName)
            </li>

            <li>
                @Html.LabelFor(m => m.Email)
                @Model.Email
                @Html.HiddenFor(m => m.Email)
            </li>

            <li>
                @Html.LabelFor(m => m.PhoneNumber)
                @Html.TextBoxFor(model => model.PhoneNumber)
                <br />
                @Html.ValidationMessageFor(model => model.PhoneNumber)
            </li>

            <li>
                @Html.LabelFor(m => m.FaxNumber)
                @Html.TextBoxFor(model => model.FaxNumber)
                <br />
                @Html.ValidationMessageFor(model => model.FaxNumber)
            </li>
            @Html.HiddenFor(model => model.AddressID)
            @Html.Partial("Address", Model.Address)

            <li>
                <label>&nbsp;</label>
                @Html.HiddenFor(m => m.ID)
                <input type="submit" value="Save" id="editButton" />
                <input type="button" value="Cancel" id="cancelButton" />
            </li>

        </ol>
    </div>
}

<script language="javascript" type="text/javascript">

    function OnDeleted(result) {
        if (result == true) {
            document.location.href = "/UserProfile/";
        }
    };

    function OnError(err) {
        $('<div title="Case Centre"><p>' + err + '</p></div>').dialog();
    };

    $(document).ready(function () {

        var cc = new CaseCentre();
        cc.BindCancel('#cancelButton', '@Url.Content("~/UserProfile/")');

    });
</script>
